package com.liukai.todo_android.entity.vo;


import android.os.Build;

import androidx.annotation.RequiresApi;

import com.liukai.todo_android.common.utils.DateUtil;
import com.liukai.todo_android.entity.Schedule;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author ：liukai
 * @date ：Created in 2021/8/16 3:49 下午
 * @description：用户相关信息
 * @modified By：
 * @version: $
 */
public class UpdateScheduleVo {
    /**
     * id
     */
    private Long id;
    /**
     * 标题
     */
    private String title;
    /**
     * 类型id
     */
    private Long scheduleTypeId;
    /**
     * 描述信息
     */
    private String description;
    /**
     * 附件地址
     */
    private String attachment;
    /**
     * todo开始时间
     */
    private LocalDateTime gmtStarted;
    /**
     * 计划用时
     */
    private Integer consumePlanning;
    /**
     * 0默认,1正计时,2倒计时
     */
    private Integer timingType;
    /**
     * 是否完成
     */
    private Integer finished;
    /**
     * 完成时间
     */
    private String gmtFinished;

    public Long getId() {
        return id;
    }

    public UpdateScheduleVo setId(Long id) {
        this.id = id;
        return this;
    }

    public String getTitle() {
        return title;
    }

    public UpdateScheduleVo setTitle(String title) {
        this.title = title;
        return this;
    }

    public Long getScheduleTypeId() {
        return scheduleTypeId;
    }

    public UpdateScheduleVo setScheduleTypeId(Long scheduleTypeId) {
        this.scheduleTypeId = scheduleTypeId;
        return this;
    }

    public String getDescription() {
        return description;
    }

    public UpdateScheduleVo setDescription(String description) {
        this.description = description;
        return this;
    }

    public String getAttachment() {
        return attachment;
    }

    public UpdateScheduleVo setAttachment(String attachment) {
        this.attachment = attachment;
        return this;
    }

    public LocalDateTime getGmtStarted() {
        return gmtStarted;
    }

    public UpdateScheduleVo setGmtStarted(LocalDateTime gmtStarted) {
        this.gmtStarted = gmtStarted;
        return this;
    }

    public Integer getConsumePlanning() {
        return consumePlanning;
    }

    public UpdateScheduleVo setConsumePlanning(Integer consumePlanning) {
        this.consumePlanning = consumePlanning;
        return this;
    }

    public Integer getTimingType() {
        return timingType;
    }

    public UpdateScheduleVo setTimingType(Integer timingType) {
        this.timingType = timingType;
        return this;
    }

    public UpdateScheduleVo setFinished(Integer finished) {
        this.finished = finished;
        return this;
    }

    public Integer getFinished() {
        return finished;
    }

    public String getGmtFinished() {
        return gmtFinished;
    }

    public UpdateScheduleVo setGmtFinished(String gmtFinished) {
        this.gmtFinished = gmtFinished;
        return this;
    }

    @Override
    public String toString() {
        return "UpdateScheduleVo{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", scheduleTypeId=" + scheduleTypeId +
                ", description='" + description + '\'' +
                ", attachment='" + attachment + '\'' +
                ", gmtStarted=" + gmtStarted +
                ", consumePlanning=" + consumePlanning +
                ", timingType=" + timingType +
                ", finished=" + finished +
                ", gmtFinished=" + gmtFinished +
                '}';
    }

    @RequiresApi(api = Build.VERSION_CODES.O)
    public UpdateScheduleVo build(Schedule schedule) {
        UpdateScheduleVo updateScheduleVo = new UpdateScheduleVo();
        LocalDateTime localDateTime = schedule.getGmtFinished();
        updateScheduleVo.setId(schedule.getId())
                .setTitle(schedule.getTitle())
                .setDescription(schedule.getDescription())
                .setAttachment(schedule.getAttachment())
                .setFinished(schedule.getFinished())
                .setGmtStarted(schedule.getGmtStarted())
                .setTimingType(schedule.getTimingType())
                .setConsumePlanning(schedule.getConsumePlanning())
                .setScheduleTypeId(schedule.getScheduleTypeId())
                .setGmtFinished(schedule.getGmtFinished().toString());
        return updateScheduleVo;
    }

}
